package lab6;

import java.util.Scanner;


 class MyInteger {
    int value;

    public MyInteger() {
    }

    public MyInteger(int value) {
        this.value = value;
    }

    public int getValue() {
        return value;
    }

    public boolean isEven(){
        return value % 2 == 0;
    }

    public static boolean isEven(int x){
        return x % 2 == 0;
    }

    public static boolean isEven(MyInteger x){
        return x.value % 2 == 0;
    }

    public boolean isOdd(){
        return value % 2 == 1;
    }

    public static boolean isOdd(int x){
        return x % 2 == 1;
    }

    public static boolean isOdd(MyInteger x){
        return x.value % 2 == 1;
    }

    public boolean isPrime(){
        for (int i = 2; i <= Math.sqrt(value); i++)
            if (value % i == 0) return false;
        return true;
    }

    public static boolean isPrime(int x){
        for (int i = 2; i <= Math.sqrt(x); i++)
            if (x % i == 0) return false;
        return true;
    }

    public static boolean isPrime(MyInteger x){
        for (int i = 2; i <= Math.sqrt(x.value); i++)
            if (x.value % i == 0) return false;
        return true;
    }

    public boolean equals(int x){
        return value == x;
    }

    public boolean equals(MyInteger x){
        return value == x.value;
    }

    public static String parseInt(char[] x){
        StringBuilder result = new StringBuilder();
        for (char c : x)
            result.append(c);
        return result.toString();
    }

    public static int parseInt(String x){
        int result = 0;
        for (int i = 0; i < x.length(); i++) {
            result = result *10 + x.charAt(i) - '0';
        }
        return result;
    }
}



public class TestTime {
	public static void main(String[] args) {
		MyInteger mInt = new MyInteger(13);
		System.out.println(mInt.getValue());
		System.out.println("mInt is even?" + mInt.isEven());
		System.out.println("mInt is odd?" + mInt.isOdd());
		System.out.println("mInt is prime?" + mInt.isPrime());
		System.out.println("5 is even?" + MyInteger.isEven(5));
		System.out.println("6 is odd?" + MyInteger.isOdd(6));
		System.out.println("3 is prime?" + MyInteger.isPrime(3));
		MyInteger newInt = new MyInteger(12);
		System.out.println("mInt = newInt?" + mInt.equals(newInt));
		System.out.println("newInt = 14?" + newInt.equals(14));
		System.out.println(MyInteger.parseInt(new char[] {'1','2','3'}));
		System.out.println(MyInteger.parseInt("123"));
	}
}